package com.sh.data.engine.domain.datadev.flink.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sh.data.engine.domain.datadev.flink.model.domain.FlinkSqlTaskDomain;
import com.sh.data.engine.repository.dao.datadev.entity.FlinkNodeConfigEntity;

import java.util.List;

/**
 * @author: zigui.zdf
 * @description:
 * @date: 2021/6/3 14:19
 */
public interface FlinkSqlTaskService {

    void delete(Long nodeId);

    void saveBaseConfig(Long nodeId, String userId, Long projectId);

    void saveScript(Long nodeId, String script, String userId, Long projectId);

    void saveSource(Long nodeId, String sourceConfig, String userId, Long projectId);

    void saveSourceOnly(Long nodeId, String sourceConfig, String userId);

    void saveSink(Long nodeId, String sinkConfig, String userId, Long projectId);

    void saveDim(Long nodeId, String dimConfig, String userId, Long projectId);

    void saveEnv(Long nodeId, String envConfig, String userId, Long projectId);

    void saveSchedule(Long nodeId, String scheduleConfig, String userId, Long projectId);

    void reCalculateNextStartAndStopTime(Long nodeId, boolean includeToday);

    FlinkSqlTaskDomain getById(Long id);

    FlinkSqlTaskDomain getActiveByNodeId(Long nodeId);

    FlinkNodeConfigEntity getActiveEntityByNodeId(Long nodeId);

    List<FlinkSqlTaskDomain> getAllRunnableTaskList();

    List<FlinkSqlTaskDomain> getAllTaskList();

    List<FlinkSqlTaskDomain> getAllStoppableTaskList();

    void publish(Long nodeId, Integer status, String userId, String remark);

    IPage<FlinkSqlTaskDomain> getVersions(Long nodeId, Integer pageNum, Integer pageSize);

    void rollbackVersion(Long nodeId, Long versionId);

    List<FlinkSqlTaskDomain> getTaskByDsId(Integer dsId);
}
